package com.ler.yrmall.order.listener;

import com.ler.yrmall.coupon.dto.SeckillOrderDTO;
import com.ler.yrmall.order.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author Leron
 * @version 1.0
 */
@Slf4j
@Service
@RocketMQMessageListener(consumerGroup = "seckill-order-group",topic = "seckill_order")
public class SeckillOrderListener implements RocketMQListener<SeckillOrderDTO> {

    @Resource
    private OrderService orderService;

    @Override
    public void onMessage(SeckillOrderDTO message) {
        log.info("秒杀订单信息:{}",message);
        orderService.createSeckillOrder(message);
    }

}
